import { createBrowserRouter, Navigate } from "react-router-dom";
import Main from '../pages/main'
import Home from "../pages/home";
import Mall from "../pages/mall";
import User from "../pages/user/user";
import PageOne from "../pages/other/pageOne";
import PageTwo from "../pages/other/pageTwo";
import Login from "../pages/login";
import Register from "../pages/register"
import LandingPage from "../pages/landing/landing";

const routes = [{
    path: '/',
    Component: Main,
    children: [
        //重定向
        {
            path: '/',
            element: <Navigate to="landing" replace></Navigate>
        },
        {
            path: 'home',
            Component: Home
        },
        {
            path: 'mall',
            Component: Mall
        },
        {
            path: 'user',
            Component: User
        },
        {
            path: 'other',
            children: [
                {
                    path: 'PageOne',
                    Component: PageOne
                },
                {
                    path: 'PageTwo',
                    Component: PageTwo
                }
            ]
        }
    ]
},
{
    path: '/login',
    Component: Login,
},
{
    path:'/register',
    Component: Register
},
{
    path:'/landing',
    Component:LandingPage
},


]
export default createBrowserRouter(routes)

